﻿namespace Sidvall.CodeGenerator
{
    public class FolderItem
    {
        public string FolderPath { get; set; }
        public string Namespace { get; set; }
        public bool DefaultIsValid { get; set; } = true;

        #region ExcludedItems

        private NameCollection _ExcludedItems;
        public NameCollection ExcludedItems
        {
            get
            {
                if (_ExcludedItems == null)
                    _ExcludedItems = new NameCollection();
                return _ExcludedItems;
            }
        }

        #endregion
        #region IncludedItems

        private NameCollection _IncludedItems;
        public NameCollection IncludedItems
        {
            get
            {
                if (_IncludedItems == null)
                    _IncludedItems = new NameCollection();
                return _IncludedItems;
            }
        }

        #endregion
        #region IsValid

        public bool IsValid(string item)
        {
            if (this.IncludedItems.Contains(item))
                return true;
            if (this.ExcludedItems.Contains(item))
                return false;
            return this.DefaultIsValid;
        }

        #endregion
    }
}
